<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@ page import="java.io.*" %>
<% if (request.getMethod().equals("POST")) {
  
  
  String password = (String) request.getParameter("password");
 
  Boolean logged_in = false;
  
  
  String path = application.getRealPath("password.conf");
  
  FileReader reader = new FileReader(path);
  BufferedReader buffered = new BufferedReader(reader);
  String stored_password = buffered.readLine();
 
  if (password != null && password != "") {
    if (password.equals(stored_password)) {
      logged_in = true;
   }
  }
  session.setAttribute("logged_in", logged_in);
  response.sendRedirect("manager");
}

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>wEvo</title>
 <link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
  <h1> wEvo - Distributed Evolutionary Framework </h1>
  <h2> System administration </h2>
  <form method="post" action=".">
  <p>
  <label> Password: </label> <br /> <input size="4" type="password" name='password' /> 
  </p>
  <p>
  <input type="submit" value="login"/>
  </p>
  </form>
  <br />
  <h2> Tasks </h2>
  <a href="worker.jsp"> Start worker </a> <br/> <br />
  <a href="charts.jsp"> View charts  </a>
  
  
</body>
</html>